package com.num2.controller.scf;

import javax.annotation.Resource;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import com.num2.form.scf.InformationForm;
import com.num2.model.scf.InformationModel;
import com.num2.service.scf.InformationService;

@Controller
public class InformationCtrl {
	@Resource
	private InformationService informationService;

	@RequestMapping("/select")
	public String Select(InformationForm informationForm, Model m) {
		InformationModel informationModel = informationService
				.select(informationForm);
		if (informationModel != null) {
			m.addAttribute("name", informationModel.getName());
			m.addAttribute("sex",informationModel.getSex());
			m.addAttribute("birthday", informationModel.getBirthday());
			m.addAttribute("address", informationModel.getAddress());
			m.addAttribute("id_card", informationModel.getId_card());
			m.addAttribute("telephone", informationModel.getTelephone());
			m.addAttribute("photo_path",informationModel.getPhoto_path());
			return "information";
		} else {
			return "error";
		}
	}

	public InformationService getInformationService() {
		return informationService;
	}

	public void setInformationService(InformationService informationService) {
		this.informationService = informationService;
	}

	
}